- Introduction
Chunky.lib is a small link library containing several functions to provide
chunky graphics usage. I hope this will be useless in future AmigaOS
versions, but now this is only way to use fast 8bit graphics on AGA.
Most of it's functions are written in pure assembly to gain maximum
perfomance, but I suppose some can be well much faster...
It contains only basic chunky functions like chunky allocation,
copying and pixel writing/reading. Nothing more included, nothing more
that much needed. Sorry.
There aren't any c2p routines included, so You have to use Your own, or
to compine chunky.lib with the rtgmaster.library usage, what I preffer.
(See some examples)
- PowerPC support
There is ofcourse also a version of chunky.lib for PowerPC, it's fully
native and doesn't make any context switches. The interface is completely
the same as for the 68k chunky.lib, so if You will enable the 'OPT PPC'
option, PowerD will automaticaly select the correct PowerPC version.
In the PowerPC version is one missing function, the DrawTriangle(), sorry.
As You can see, this library still lack many important functions, but
some of them provides rtgmaster.library, please see it's documentation.
- Basic functions
- CreateChunky(width,height)(PTR)
Allocates and clears memory for 8bit chunky memory field of size width x height.
- CreateChunky32(width,height)(PTR)
Allocates and clears memory for 32bit (ARGB) chunky memory field of size width x height.
- CreateChunky32Z(width,height)(PTR)
Allocates and clears memory for 32bit (ARGB) chunky and 32bit z-buffer memory field of size width x height.
- DeleteChunky(chunky)
Frees memory allocated by one of above functions.
- Lowlevel drawing functions
There is currently only pixel writing/reading functions.
- PutPixel(chunky,x,y,colour)(L)
Write a pixel of colour to coordinates of x and y in chunky.
Returns previous pixel on this position in the chunky.
- PutPixelFast(chunky,x,y,colour)
Write a pixel of colour to coordinates of x and y in chunky.
It doesn't check if the coordinates fits to the chunky, so
use it only if You are sure, that it fits!!!
- PutPixel32(chunky,x,y,colour)(L)
Write a pixel of colour (ARGB) to coordinates of x and y in chunky.
Returns previous pixel (ARGB) on this position in the chunky.
- PutPixel32Z(chunky,x,y,colour,z)(L,F)
Write a pixel of colour (ARGB) to coordinates of x and y in chunky if
the z value is lower then the z-buffer value in the chunky.
Returns previous pixel (ARGB) and previous z-buffer value on this
position in the chunky.
- GetPixel(chunky,x,y)(L)
Returns pixel colour on the position of x and y in the chunky.
- GetPixel32(chunky,x,y)(L)
Returns pixel colour (ARGB) on the position of x and y in the chunky.
- GetPixel32Z(chunky,x,y)(L,F)
Returns pixel colour (ARGB) and z-buffer value on the position of
x and y in the chunky.
- FillChunky(chunky,colour)
Fills the 8bit chunky buffer with colour. Be sure, that the chunky width
must be aligned to four byte boundary (dividable by four).
- FillChunky32(chunky,colour)
Fills the 32bit (ARGB) chunky buffer with colour. As this function
uses 32bit colour definition, it doesn't any alignation.
- FillChunky32Z(chunky,colour,zdist)
Fills the 32bit (ARGB) chunky buffer with colour and the zbuffer with
a value of zdist. As this function uses 32bit colour definition, it
doesn't any alignation.
- Highlevel drawing functions
- DrawTriangle(chunky,xy:PTR TO FLOAT,colour)
This function draws a filled triangle in to the chunky. The triangle
coordinates must be provided as a field of three pairs of floats.
Note: This function is pretty slow as it is written in assembly only
partialy. It can be usefull only for simplier objects. On 040/25 it
does between 3000-8000 (small) triangles per second, so please don't
await too much :)
- Conversion functions
As I said above, this is only for temporaryli usage, so stay calm, anything
'revolutionary' isn't here :)
- Pack32(a,r,g,b)(UL)
This converts alpha, red, green and blue components of colour into
one 32bit (ARGB) colour.
- UnPack32(argb)(L,L,L,L)
This converts the 32bit (ARGB) colour into it's separated components
of red, green, blue and alpha (in this order!!!).
- Conv24To8(argb)(L)
Converts single 24bit colour (alpha is left) into 8bit gray scale.
- Conv24ToGray(chunky8,chunky32)(L)
Converts whole 32bit chunky buffer (alpha is left) into 8bit gray scale
chunky buffer.
- Chunky copying routines
- ChunkyCopy(dst,dx,dy,src,sx,sy,w,h)
Copy a part of src chunky starting on sx and sy coordinates into the
dst chunky starting at dx and dy coordinates. Copied block is w x h
pixels large.
- ChunkyCopyMask(dst,dx,dy,src,sx,sy,w,h)
The same as above, but all the zero pixels from the source are skipped.